package MyLinkedList;

import java.util.ArrayList;
import java.util.LinkedList;
import java.util.List;

public class Test {


    public static void main(String[] args) {
        // 构造一个空的LinkedList
        List<Integer> list1 = new LinkedList<>();
        List<String> list2 = new java.util.ArrayList<>();
        list2.add("JavaSE");
        list2.add("JavaWeb");
        list2.add("JavaEE");
// 使用ArrayList构造LinkedList
        List<String> list3 = new LinkedList<>(list2);
    }

    public static void main3(String[] args) {
        LinkedList<Integer> list=new LinkedList<>();
        List<Integer> list2=new LinkedList<>();
        list2.add(1);
        list2.add(2);
        list2.add(1,3);
        System.out.println(list2);

//        ArrayList<Integer> arrayList=new ArrayList<>();
//        List<Integer> ret=new LinkedList<>(arrayList);//可以把list2作为参数
    }

    public static void main2(String[] args) {
        MyLinkedList myLinkedList=new MyLinkedList();
        myLinkedList.addLast(100);
        myLinkedList.addLast(1);
        myLinkedList.addLast(2);
        myLinkedList.addLast(100);
        myLinkedList.addLast(3);
        myLinkedList.addLast(4);
        myLinkedList.addLast(5);
        myLinkedList.addLast(100);
        myLinkedList.display();
        myLinkedList.remove(100);
        myLinkedList.display();

    }
    public static void main1(String[] args) {
        MyLinkedList myLinkedList=new MyLinkedList();
        myLinkedList.addFirst(1);
        myLinkedList.addFirst(2);
        myLinkedList.addFirst(3);
        myLinkedList.addFirst(4);
        myLinkedList.display();
        myLinkedList.addLast(5);
        myLinkedList.addLast(4);
        myLinkedList.addLast(3);
        myLinkedList.display();
        myLinkedList.addIndex(0,99);
        myLinkedList.addIndex(8,99);
        myLinkedList.addIndex(3,99);
        myLinkedList.display();

    }
}
